def merge(left, right):
    '''排序合并两个数列'''
    print(left)
    reslt=[]
    # 两个数列都有值
    while len(left)>0 and len(right)>0:
        if left[0]<=right[0]:
            reslt.append(left.pop(0))
        else:
            reslt.append(right.pop(0))
    reslt+=left
    reslt+=right
    return reslt


def mergeSort(lt):
    if len(lt)==1:
        return lt
    #使用二分数列
    mid= len(lt) // 2
    left= lt[:mid]
    right= lt[mid:]
    # 使用递归运算
    mergeLeft=mergeSort(left)
    mergeRight=mergeSort(right)
    return merge(mergeLeft,mergeRight)

t=int(input())
for i in range(t):
    n=int(input())
    lt=list(map(int,input().split()))
    lt=mergeSort(lt)
    for i in lt:
        print(i,end=' ')
    print()